<?php
if(!isset($_SERVER["HTTP_X_REQUESTED_WITH"]) || strtolower($_SERVER["HTTP_X_REQUESTED_WITH"])=="xmlhttprequest"){
    //exit('Authorized Failed!');
}
include "db.php";
include "config.php";
$db = new Mysql( DB_HOST , DB_USER , DB_PASS , DB_NAME , null , 'utf-8' );
$sql = 'select value from config where key="start_shake"';
$db->query($sql);
$result = $db->fetch_row();
if( $result['value'] != 1 ){
    echo "not start";
}
$shakeCount = (int)htmlspecialchars( $_POST['shakeCount'] );
$openid = htmlspecialchars( $_POST['openid'] );
$db->update( 'wx_user' , 'shake_count = '.$shakeCount , 'openid="'.$openid.'"' );
echo "ok";
?>